<template>
  <div class="payment">
      <div class="box">
          <el-card>
            <el-table :data="tableData" border style="width: 100%" >
                <el-table-column  label="序号" align="center" type="index"> </el-table-column>
                <el-table-column prop="name" label="提现人" align="center" > </el-table-column>
                <el-table-column prop="phone" label="联系方式" align="center" > </el-table-column>
                <el-table-column prop="price" label="提现金额" align="center" > </el-table-column>
                <el-table-column prop="createTime" label="申请时间" align="center" > </el-table-column>
                <el-table-column prop="content" label="备注" align="center" > </el-table-column>
                <el-table-column  label="操作" align="center" >
                    <template slot-scope="scope">
                        <el-button @click="handlePayClick(scope.row)" type="primary" size="small" icon="el-icon-check" plain>打 款</el-button>
                        
                    </template>
                </el-table-column>
            </el-table>
        </el-card>
                <pagination
                v-show="total >0"
                :total="total"
                :page.sync="queryParams.pageNum"
                :limit.sync="queryParams.pageSize"
                @pagination="getInformationList"
                />
      </div>
    <el-dialog
  title="上传材料"
  :visible.sync="dialogVisible"
  width="35%"
  :before-close="handleClose">
<el-form  label-width="120px" :model="form1" >
  <el-form-item label="图片:" prop="coverPicture">
        <el-upload
        :headers='headers'
        class="avatar-uploader"
        :action="upImage+'/table/upload'"
        :on-success="handleAvatarSuccess"
        :show-file-list="false"
        >
        <img v-if="form1.paymentPic" :src="form1.paymentPic" class="avatar" />
        <i v-else class="el-icon-plus avatar-uploader-icon"></i>
        </el-upload>
    </el-form-item>
    <el-form-item label="备注" prop="paymentRemark">
          <el-input v-model="form1.paymentRemark" type="textarea" ></el-input>
    </el-form-item>
</el-form>
  <span slot="footer" class="dialog-footer">
    <el-button @click="dialogVisible = false">取 消</el-button>
    <el-button type="primary" @click="onSubmit">确 定</el-button>
  </span>
</el-dialog>
  </div>
</template>

<script>
import {getList,payMent,getExamine,getDsc} from '@/api/finance/index'
import { getToken } from "@/utils/auth";

export default {
  name: '',
  data () {
    return {
        tableData:[],
        headers: { Authorization: "Bearer " + getToken() },
        upImage: process.env.VUE_APP_BASE_API,
        loading:false,
        form:{
          status : undefined,
          name:'',
        },
        dialogVisible:false,
        queryParams: {
            pageNum: 1,
            pageSize: 10,
            status:2,
        },
        total:0,
        form1:{
          paymentPic:''
        },
    }
  },
  props: [],
  components: {},
  computed: {},
  filters: {},
  methods: {
    //   打款按钮
    handlePayClick(row){
      this.form1 = row
      this.dialogVisible =true
    },
    onSubmit(){
       payMent(this.form1).then(res =>{
        if(res.code == 200){
          // console.log(res);
          this.dialogVisible = false
          this.$message.success('已申请打款')
          this.getInformationList()
        }
      })
    },
    handleAvatarSuccess(res, file) {
      // console.log(URL.createObjectURL(file.raw));
      this.form1.paymentPic ='https://9001rzsxy.oss-cn-beijing.aliyuncs.com'+  res.data
        if(res.code ==200){
         this.$message.success("上传成功");
        }
    },
    handleClose(){
      this.dialogVisible = false
    },
      // 获取所有
    getInformationList() {
      this.loading = true;
      getList(this.queryParams).then(res => {
        this.tableData = res.rows
        this.total = res.total;
        this.loading = false;
      });
    },
  },
  created () {
    this.getInformationList()
  },
  mounted () {}
}
</script>

<style rel="stylesheet/scss" lang="scss">
.box{
    margin: 10px;
    // .btn{
    //     margin-top: 20px;
    // }
}
.avatar-uploader .el-upload {
  width: 148px;
  height: 148px;
  border: 1px dashed #d9d9d9;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.avatar-uploader .el-upload:hover {
  border-color: #20a0ff;
}

.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 148px;
  height: 148px;
  line-height: 148px;
  text-align: center;
  border: 1px dashed #ccc;
}

.avatar {
  width: 148px;
  height: 148px;
  display: block;
}
</style>
